package com.one.blocks.rbac.util;

import com.one.blocks.rbac.domain.SysRole;
import lombok.experimental.UtilityClass;

/**
 * @author <a href="mailto:idler41@163.com">linfuxin</a> created by 2022-05-03 09:36:48
 */
@UtilityClass
public class SubjectRoleHelper {
    public static final ThreadLocal<SysRole> ROLE_THREAD_LOCAL = new ThreadLocal<>();

    public static SysRole getSysRole() {
        return ROLE_THREAD_LOCAL.get();
    }

    public static void setSysRole(SysRole sysRole) {
        ROLE_THREAD_LOCAL.set(sysRole);
    }

    public static void clear() {
        ROLE_THREAD_LOCAL.remove();
    }
}
